package com.v1.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;

import com.v1.cache.RecentCache;
import com.v1.lo.BaseLO;
import com.v1.lo.Statement;
import com.v1.util.Constant;

public class IndexAction extends DefaultAction {

	public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		RecentCache recentCache = (RecentCache) getBean("RecentCache");
		setAttribute(request, "recents", recentCache.getRecents());

		BaseLO lo = (BaseLO) getBean("BaseLO");

		// TODO 首页显示热门tag
		List<LabelValueBean> tags = lo.queryForList(((Constant) getBean("Constant")).TAG_COUNT,
				Statement.Scattered_getHotTag);
		setAttribute(request, "tags", tags);
		return mapping.findForward("index");
	}
}